package com.oop.exception;

public class Demo02 {
    public static void main(String[] args) {
        try {
            new Demo02().test(1,0);
        } catch (ArithmeticException e) {
           e.printStackTrace();
        }


    }
public  void test(int a,int b ) throws ArithmeticException{

        if (b==0){   //throw   throws
            throw  new ArithmeticException();   //主动抛出异常
        }
    System.out.println(a/b);

    }
}

/*

            } catch (Error e) {   //catch想要捕获的异常类型
                System.out.println("Error");
            }catch (Exception e){
                System.out.println("Exception");
            }catch (Throwable t){
                System.out.println("Throwable");
            } finally {
                System.out.println("finally");
            }

 */